namespace YXShop.ExcelLite
{
    using System;
    using System.Reflection;

    public class ExcelCellCollection : ExcelRowColumnCellCollectionBase
    {
        internal ExcelCellCollection(ExcelWorksheet parent) : base(parent)
        {
        }

        internal ExcelCellCollection(ExcelWorksheet parent, ExcelCellCollection sourceCells) : base(parent)
        {
            foreach (ExcelCell cell in sourceCells)
            {
                base.Items.Add(new ExcelCell(base.Parent, cell));
            }
        }

        private void AdjustArraySize(int index)
        {
            if (index > (base.Items.Count - 1))
            {
                ExcelColumnCollection.ExceptionIfColumnOutOfRange(index);
                int num = index - (base.Items.Count - 1);
                for (int i = 0; i < num; i++)
                {
                    base.Items.Add(new ExcelCell(base.Parent));
                }
            }
        }

        public ExcelCell this[int index]
        {
            get
            {
                this.AdjustArraySize(index);
                return (ExcelCell) base.Items[index];
            }
        }
    }
}

